<div id="saveButton">
	<div class="saveButtonLabel">
        {if $page->getPublicationStatusWithTemp() == 'VALIDATION'}
            {icon name="status/VALIDATION_big.png"} {t}to validate{/t}
        {/if}
        {if $page->getPublicationStatusWithTemp() == 'DRAFT'}
            {icon name="status/DRAFT_big.png"} {t}unpublished{/t}
        {/if}
        {if $page->getPublicationStatusWithTemp() == 'PUBLISHED'}
            {icon name="status/PUBLISHED_big.png"} {t}published{/t}
        {/if}
    </div>
    <div class="saveButtonMid">
        <ul class="saveButtons">
            <li class="first">
                <a href="{$URL_RELATIVE}/?module=website&amp;action=Display&amp;pageId={$page->getUniqueId()}&amp;pageLang={$page->getLang()}&amp;preview=1" id="previewModifications" target="_blank" class="toolTip switch{if $page->getPublicationStatusWithTemp() == 'VALIDATION'} active{/if}" title="{t}Preview - Click here to preview the modified page.{/t}">
                    {icon name="view.png" title=""} {t}Preview the page{/t}
                </a>
            </li>
            <li>
                <a href="javascript:void(0);" id="undoModifications" class="toolTip switch{if $page->getPublicationStatusWithTemp() == 'VALIDATION'} active{/if}" onclick="undoModifications({$page->getUniqueId()},'{$page->getLang()}');" title="{t}Cancel - By clicking here, you cancel modifications, you will be redirected to the previous page version.{/t}">
                    {icon name="menu_undo.png" title=""} {t}Cancel modifications{/t}
                </a>
            </li>
            {hasRight rule=website_TabPageStructure}
            <li>
                <a href="javascript:void(0);" class="toolTip active" onclick="displayBlockBar();" title="Insérer - En cliquant ici vous pouvez insérer des blocs de contenu dans la page.">
                    {icon name="block.png" title=""} {t}Insert block{/t}
                </a>
            </li>
            {/hasRight}
        </ul>
    </div>
	{hasRight rule=website_ValidatePage}
    <div class="saveButtonRight">
        <button onclick="savePageModifications({$page->getUniqueId()},'{$page->getLang()}');" class="bigGreenButton toolTip{if $page->getPublicationStatusWithTemp() == 'VALIDATION'} active{/if}" title="{t}Validate - Click here to save the page modifications. If the page is published, modifications will be automatically showed on the website.{/t}" {if $page->getPublicationStatusWithTemp() != 'VALIDATION'} disabled="disabled"{/if}>{t assignTo=iconTitle}Validate modifications{/t}{icon name="disk.png" title=$iconTitle} {t}Save{/t}</button>
        <button class="bigGreyButton active" onclick="displayPageSaveLayout();">...</button>
    </div>
	{/hasRight}
    &nbsp;
</div>

<div id="saveButtonSubMenu">
    <ul>
        <li><a class="bigGreyButton nyroModal" href="{$URL_RELATIVE}/bo/#{url route='websiteSavePageAsLayout' docId=$page->getUniqueId() docLang=$page->getLang()}">{icon name="disk.png" title=$iconTitle} Enregistrer comme gabarit</a></li>
    </ul>
</div>

<div style="display:none" id="pageId">{$page->getUniqueId()}</div>
<div style="display:none" id="pageLang">{$page->getLang()}</div>

<div id="blockPanel">
    <div class="blockPanelModules">
        <div class="blockPanelModulesTitle">{icon name="block_white.png" size="24"} {t}Modules selection{/t} {icon name="arrowRight.png" size="24"}</div>
        <div class="blockPanelModulesCatContainer">
            <div class="blockPanelModulesCat"></div>
        </div>
        <div class="blockPanelClose"><a href="javascript:void(0);" onclick="hideBlockBar();">{t}Close{/t} {icon name="close_black.png"}</a></div>
        <div class="blockPanelSlide"><a href="javascript:void(0);" class="blockPanelSlideLeft inactive"></a><a href="javascript:void(0);" class="blockPanelSlideRight"></a></div>
    </div>
    <div class="blockPanelBlocks">
        <div class="dndBlocksHelp">
            {t}Drag and drop the selected block in the page{/t}
        </div>
        <div class="dndBlocksContainer">
            <div class="dndBlocks"></div>
        </div>
        <div class="blocksSlider">
            <a href="javascript:void(0);" class="blocksSlideLeft inactive"></a>
            <span id="currentBlocksPage">1</span> {t}of{/t} <span id="nbBlocksPages"></span>
            <a href="javascript:void(0);" class="blocksSlideRight"></a>
        </div>
    </div>
</div>

<div id="pageStructureEdit">
{$page->getTemplateStructure()}
<div class="clear"></div>
</div>

{if count($page->getUnusedBlocks()) > 0}
<div id="unused">
    <div class="dndBlocksHelp">{icon name="warning.png"} {t}You have unused blocks, drag & drop them into the page.{/t}</div>
    <div id="freeContent99_1" class="freeContentZone">
    {foreach from=$page->getUnusedBlocks() item=unusedBlock}
    <dl id="block_{$unusedBlock.blockId}" class="block">
        <dt>{$unusedBlock.buttons}{icon name=$unusedBlock.blockIcon}<span>{$unusedBlock.blockLabel}</span></dt>
        <dd class="rawValues">{$unusedBlock.rawValues}</dd>
    </dl>
    {/foreach}
    </div>
</div>
{/if}

{hasRight rule=website_TabPageStructure}
<script type="text/javascript">
	dragAndDropPageBlocks({$page->getUniqueId()},"{$page->getLang()}");

    {literal}
    $('.saveButtonMid a').click(function(event){
        if(!$(this).hasClass('active'))
        {
            event.preventDefault();
        }
    });
    {/literal}
</script>
{/hasRight}